package com.lanyou.esb.datadictionary;

import java.rmi.NoSuchObjectException;

import org.apache.commons.lang3.StringUtils;

/**
 * 告警类型<br>
 * 描述： <br>
 * 1：请求超时；2：请求超限；3：Http400错误；
 * 
 * @author Davey.wu
 */
public enum AlarmType {
	REQUEST_TIMEOUT("1"), REQUEST_OVER_LIMIT("2"), HTTP_400("3");

	public static final String TypeCode = "20014";

	public final String ValueCode;

	private AlarmType(String code) {
		this.ValueCode = code;
	}

	public static AlarmType get(String valueCode) throws NoSuchObjectException {
		if (StringUtils.isEmpty(valueCode)) {
			throw new NullPointerException();
		}
		for (AlarmType type : AlarmType.values()) {
			if (type.ValueCode.equals(valueCode)) {
				return type;
			}
		}
		throw new NoSuchObjectException(valueCode);
	}
}
